#include "character.h"

CharacterClass::CharacterClass()
{

}

CharacterClass::~CharacterClass()
{

}

QPair<QString,QString> CharacterClass::whatsCareer(QString subCareer)
{
    for(auto it = CareerData.constBegin(); it != CareerData.constEnd(); ++it)
    {
        QString baseCareer = it.key();
        QList<SubCareerInfo>careerList = it.value();
        for(const auto &x : careerList)
        {
            SubCareerInfo info = x;
            if(info.subCareerName == subCareer)
            {
                return qMakePair(baseCareer,info.damageType);
            }
        }
    }
    return QPair<QString,QString>();
}

QString CharacterClass::whatsArmorMastery(QString subCareer)
{
    for(auto it = CareerData.constBegin(); it != CareerData.constEnd(); ++it)
    {
        QList<SubCareerInfo>careerList = it.value();
        for(const auto &x : careerList)
        {
            SubCareerInfo info = x;
            if(info.subCareerName == subCareer)
            {
                return info.armorType;
            }
        }
    }
    return QString();
}

QList<QString> CharacterClass::subCareerList()
{
    QList<QString>list;
    for(auto it = CareerData.constBegin(); it != CareerData.constEnd(); ++it)
    {
        QList<SubCareerInfo>careerList = it.value();
        for(const auto &x : careerList)
        {
            SubCareerInfo info = x;
            list.push_back(info.subCareerName);
        }
    }
    return list;
}

